#ifndef MUTACURVE_H
#define MUTACURVE_H

#include "MutaObject.h"
#include "QObject"
#include "ControlPoint.h"
#include "MutaAttractor.h"

class MutaCurve : public MutaObject, public QGraphicsPathItem
{
    Q_OBJECT
public:
    MutaCurve(QString ObjectID,QString owner,QPointF p1,QPointF p2,int layer);
    MutaCurve(QString ObjectID,QString owner,QPointF p1,QPointF p2,int layer, int zero);

    virtual void setPos(const QPointF &pos);
    void setFinalPoint(QPointF p);
    void addControlPoint(QPointF p);
    void addControlPointNQ(QPointF p);
    void setPoint(int num, QPointF p);
    int getLayer();
    QStringList getProperties();
    int type() const;
    void forceOSCthulhuUpdate();
    void setControlPoints(QString aCps);
    QPolygonF getCurvePoly();
    int getCurveProgress();
    void setCurveProgress(int curveProgress);

protected:
    void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
    void mouseMoveEvent(QGraphicsSceneMouseEvent *event);
    QVariant itemChange(GraphicsItemChange change, const QVariant &value);

private:
    QList<ControlPoint*> controlPoints;
    void buildPath();
    void setColor();
    int time;
    QColor boxColor;
    QBrush boxBrush;
    QPen boxPen;
    int layer;
    void buildControlPointString();
    QString controlPointString;
    int curveProgress;
    QPolygonF curvePoly;

signals:
    void ellipseAdded(QGraphicsItem* ellipse);
    void controlPointAdded(QString objectID,QString controlPointString);

public slots:
    void cPointMoved(QPointF pos,int num);
    //void curvePointMoved(QPointF pos,int num);

};

#endif // MUTACURVE_H
